package com.example.ppjoke;

import android.app.Application;

import com.alibaba.android.arouter.launcher.ARouter;
import com.example.base_application.BaseApplication;
import com.example.loadimg_sdk.GlideApp;
import com.example.sofa_module.UmengConst;
import com.meituan.android.walle.WalleChannelReader;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;


public class APP extends BaseApplication {
    private static APP instance;
    private String channel;
    public static APP getInstance() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
//        channel = WalleChannelReader.getChannel(this);
//        if (channel==null)
//            channel = "test";
        AppConfig.getInstance();
        ARouter.openLog();
        ARouter.openDebug();
        ARouter.init(this);
        UMConfigure.setLogEnabled(true);
        UMConfigure.init(this, UmengConst.UMENGKEY,"channel",
                UMConfigure.DEVICE_TYPE_PHONE,UmengConst.UMENGSECRET);
        PlatformConfig.setSinaWeibo(UmengConst.SINAKEY,UmengConst.SINASECRET,
                UmengConst.SINABACKURL);
        PlatformConfig.setSinaFileProvider("com.mooc.ppjoke.fileprovider");
    }

    @Override
    public void onTrimMemory(int level) {
        super.onTrimMemory(level);
        if (level==TRIM_MEMORY_RUNNING_LOW){
//            GlideApp.get(this).clearDiskCache();
        }
    }
}
